<template>
  <div class="common-body-wrapper">
    <search-header
      single-width="120"
      :searchList="searchList"
      @changeHeight="toRetTable"
      @confirmSearch="toSearch"
    ></search-header>
    <multi-fun-table
      :sortColumn="notFormatColumn"
      :orderType="sortType"
      :fixed-cols="fixedCols"
      :is-reset-table="isResetTable"
      :theads-info="theadsInfo"
      :tbodys-info="tbodysInfo"
      @handleMultiCheck="handleMultiCheck"
      @handleSortColumn="handleSortColumn"
      @searchFn="getList"
      @getNextPage="getNextPage"
    >
      <div class="operate-btn-group" slot="operateBtnGroup">
        <a
          class="ake_btn ake_btn_text"
          v-if="isPermmited('PLATFORM:PARKCOUPON:WATER:EXPORT')"
          @click.prevent="exportData()"
        >导出</a>
      </div>
      <template slot="tdCell" slot-scope="props">
        <el-table-column
          :fixed="props.fixed"
          :label="props.label"
          :min-width="props.minWidth"
          :width="props.width"
          :prop="props.prop"
          :sortable="props.sortable"
        >
          <template slot-scope="scope">
            <span v-if="'reno' == props.prop">{{scope.$index+1}}</span>
            <span
              v-else-if="'faceValue' == props.prop || 'reliefValue' == props.prop || 'totalShouldValue' == props.prop"
            >{{scope.row[props.prop] | formatMoney}}</span>
            <span v-else-if="'useTime' == props.prop">{{scope.row[props.prop] | mileSecondToDate}}</span>
            <span
              v-else-if="'applySceneType' == props.prop"
            >{{scope.row[props.prop] | applySceneType}}</span>
            <span v-else-if="'applyObj' == props.prop">{{scope.row[props.prop] | applyObj}}</span>
            <span v-else-if="'reliefType' == props.prop">{{scope.row[props.prop] | reliefType}}</span>
            <span v-else>{{ scope.row[props.prop] }}</span>
          </template>
        </el-table-column>
      </template>
    </multi-fun-table>

    <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>
    <big-pic-modal ref="bigPicModal">
      <img
        slot="bigImgSlot"
        :src="bigImgPath | setImgPath"
        alt
        @error="imgError('../../', 'car', $event)"
      />
    </big-pic-modal>
  </div>
</template>

<script>
import common from "@mixins/common.js";
import stardardList from "@mixins/tables/stardardList.js";

//modal
import invokeModal from "@mixins/modal/invokeModal.js";
import BigPicModal from "@components/widgets/BigPicModal.vue";

// image
import images from "@mixins/image.js";

// 引进vue的js
import compaign_coupon_water from "./js/compaign_coupon_water.js";
export default {
  name: "compaignCouponWater",
  mixins: [common, stardardList, invokeModal, images, compaign_coupon_water],
  components: {
    BigPicModal
  },
  data() {
    return {
      fixedCols: 3,
      total: 0,

      //prop-返回数据的字段名称   proisNotInter:true,pNameisNotInter:true,，name-查询字段传参名称    text-显示名称  //initHidden  初始化不显示
      searchList: [
        {
          type: "text",
          isShow: false,
          name: "query_couponName",
          text: "优惠名称",
          value: ""
        },

        {
          type: "select",
          isShow: false,
          name: "query_applySceneType",
          text: "二维码性质",
          value: "",
          options: [
            { name: "全部", value: "" },
            { name: "公开", value: "0" },
            { name: "内部", value: "1" }
          ]
        },
        {
          type: "select",
          isShow: false,
          name: "query_reliefType",
          text: "优惠类型",
          value: "",
          options: [
            { name: "全部", value: "" },
            { name: "全免优惠", value: "0" },
            { name: "扣减优惠", value: "1" },
            { name: "折扣优惠", value: "2" },
            { name: "定额优惠", value: "3" },
            { name: "时间优惠", value: "4" }
          ]
        },
        {
          type: "select",
          isShow: false,
          name: "query_applyObj",
          text: "适用对象",
          value: "",
          options: [
            { name: "全部", value: "" },
            { name: "一点停手机用户", value: "0" },
            { name: "一点停微信用户", value: "1" },
            { name: "游客", value: "2" },
            { name: "特定用户", value: "3" }
          ]
        },

        {
          type: "datePicker",
          isShow: false,
          name: "query_time",
          text: "使用时间",
          propName: "query_useTimeFrom,query_useTimeTo",
          value: "",
          style: { width: "360px" }
        }

        // { type: 'doubleInput',isNotInter:true, names: ['query_parkingTimeStart', 'query_parkingTimeEnd'], text: 'xxxxxcccccc', values: ['', ''], style: { width: '60px' } }
      ],
      theadsInfo: [
        // { index: 0, isShow: false, prop: 'reno', text: '序号', width: 64 },
        {
          index: 1,
          isShow: false,
          prop: "couponName",
          text: "优惠名称",
          sortable: true,
          minWidth: 50
        },
        {
          index: 2,
          isShow: false,
          prop: "applySceneType",
          text: "二维码性质",
          sortable: true,
          minWidth: 50,
          initHidden: true
        },
        {
          index: 3,
          isShow: false,
          prop: "applyObj",
          text: "适用对象",
          sortable: true,
          minWidth: 70,
          initHidden: true
        },
        {
          index: 4,
          isShow: false,
          prop: "reliefType",
          text: "优惠类型",
          sortable: true,
          minWidth: 50
        },
        {
          index: 5,
          isShow: false,
          prop: "faceValue",
          text: "优惠数值",
          sortable: true,
          minWidth: 50,
          initHidden: true
        },
        {
          index: 6,
          isShow: false,
          prop: "parkName",
          text: "停车场",
          sortable: true,
          minWidth: 60
        },
        {
          index: 7,
          isShow: false,
          prop: "carCode",
          text: "车牌号码",
          sortable: true,
          minWidth: 50
        },
        {
          index: 8,
          isShow: false,
          prop: "totalShouldValue",
          text: "停车费用",
          sortable: true,
          minWidth: 50
        },
        {
          index: 9,
          isShow: false,
          prop: "reliefValue",
          text: "优惠额",
          sortable: true,
          minWidth: 50
        },
        {
          index: 10,
          isShow: false,
          prop: "useTime",
          text: "使用时间",
          sortable: true,
          minWidth: 80,
          initHidden: true
        }
      ],
      tbodysInfo: []
    };
  },
  methods: {
    cfs(params) {
      this.getList();
    }
  }
};
</script>

<style lang="less" scoped>
</style>